<%@page language="java" import="java.sql.*,java.text.*,java.util.*,com.ba360.portal.database.dao.*,com.ba360.portal.database.dbo.Adsdaobean,com.ba360.portal.util.Helper"%>           
<head>
	<link rel="stylesheet" href="../css/lightbox.css" media="screen,projection" type="text/css" /> 
	<link href="../css/theme.css" rel="stylesheet" type="text/css">  
</head>
<%
	String  initPict1 = null;
	String  initPict2 = null;
	String  initPict3 = null;
	String  initPict4 = null;
	String  initPict5 = null;
	String  initPict6 = null;

	String  comment1 = "";
	String  comment2 = "";
	String  comment3 = "";
	String  comment4 = "";
	String  comment5 = "";
	String  comment6 = "";
	SimpleDateFormat informat= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	SimpleDateFormat outformat= new SimpleDateFormat("MMM,dd");
		
	String advId = request.getParameter("adid");
	Helper help = new Helper();	
	
	// Get the path to the /Users/images from the servlet context.
	ServletContext theApplicationsServletContext = (ServletContext) session.getServletContext();
	
	int memId = help.getUserId(advId);
	String realPath = theApplicationsServletContext.getRealPath("/droik/Users/images/" + memId);
	
	if(advId!=null && advId.length()>0) {

		initPict1 = help.getOrgPath(realPath, advId, 1);
		initPict2 = help.getOrgPath(realPath, advId, 2);
		initPict3 = help.getOrgPath(realPath, advId, 3);
		initPict4 = help.getOrgPath(realPath, advId, 4);
		initPict5 = help.getOrgPath(realPath, advId, 5);
		initPict6 = help.getOrgPath(realPath, advId, 6);

		comment1 = help.getComment(1, advId);
		comment2 = help.getComment(2, advId);
		comment3 = help.getComment(3, advId);
		comment4 = help.getComment(4, advId);
		comment5 = help.getComment(5, advId);
		comment6 = help.getComment(6, advId);
	}

	if(advId==null) advId = "";
	int hits = help.updateHits(advId);
	help.Finalize();

	Adsdao   obj      = new Adsdao();  
	Vector   adsV     = obj.getAdResult(advId);
	Adsdaobean bean =new Adsdaobean();
	bean=(Adsdaobean)adsV.get(0);
%>

<tr>
<td width='100%' background="../images/border_bg2.gif">
<table>
<%
	out.print("<span class='title'>"+bean.getAdsname()+"</span>");
	out.print("<span class='title'><input type='button' value='Respond to this ad..'/></span>");
	out.print("<span class='title'><input type='button' value='Complaint'/></span>");	
	out.print("<div class='resultdiv'>");
	out.print("<span class='boldtext price'>Price :&nbsp;</span>"+bean.getPrice());
	out.print("<span class='boldtext date'>Posting Date :&nbsp;</span>"+outformat.format(informat.parse(bean.getDate())));
	out.print("<span class='boldtext visit'>Visits :&nbsp;</span>"+bean.getHits());
	out.print("</div>");
	out.print("<br>");
	out.print("<span class='boldtext email'>Email   &nbsp;&nbsp;&nbsp;&nbsp; :&nbsp;</span>"+bean.getEmail());
	out.print("<br>");
	out.print("<span class='boldtext email'>Contact :&nbsp;</span>"+bean.getContactno());
	out.print("<br>");
	out.print("<br>");
	out.print("<span class='boldtext email'><u>Description</span>");
	out.print("<br>");
	out.print("<br>");
	out.print("<div class='description'>");
	out.print(bean.getDescription());
	out.print("</div>");
%>
	<table colspan="6" style="table-layout: fixed;">
	<tr>
	<% if(initPict1!=null && initPict1.length()>0) { %>
	<td>
	<table>
	<tr>
	<td align="center" width=330px height=250px><IMG alt=Help id="image" src="<%=initPict1%>" align=absBottom border=0 name="pict1"></td>
	</tr>
	<tr>
	<td align="center" class="boldtext"><%=comment1%></td>
	</tr>
	</table>
	</td>
	<% }
	if(initPict2!=null && initPict2.length()>0) { %>
	<td>
	<table>
	<tr>
	<td align="center" width=330px height=250px><IMG alt=Help id="image" src="<%=initPict2%>" align=absBottom border=0 name="pict2"></td>
	</tr>
	<tr>
	<td align="center" class="boldtext"><%=comment2%></td>
	</tr>
	</table>
	</td>
	<% } %>
	</tr>
	<tr>
	<% if(initPict3!=null && initPict3.length()>0) { %>
	<td>
	<table>
	<tr>
	<td align="center" width=330px height=250px><IMG alt=Help id="image" src="<%=initPict3%>" align=absBottom border=0 name="pict3"></td>
	</tr>
	<tr>
	<td align="center" class="boldtext"><%=comment3%></td>
	</tr>
	</table>
	</td>
	<% }
	if(initPict4!=null && initPict4.length()>0) { %>
	<td>
	<table>
	<tr>
	<td align="center" width=330px height=250px><IMG alt=Help id="image" src="<%=initPict4%>" align=absBottom border=0 name="pict4"></td>
	</tr>
	<tr>
	<td align="center" class="boldtext"><%=comment4%></td>
	</tr>
	</table>
	</td>
	<% } %>
	</tr>
	<tr>
	<% if(initPict5!=null && initPict5.length()>0) { %>
	<td>
	<table>
	<tr>
	<td align="center" width=330px height=250px><IMG alt=Help id="image" src="<%=initPict5%>" align=absBottom border=0 name="pict5"></td>
	</tr>
	<tr>
	<td align="center" class="boldtext"><%=comment5%></td>
	</tr>
	</table>
	</td>
	<% }
	if(initPict6!=null && initPict6.length()>0) { %>
	<td>
	<table>
	<tr>
	<td align="center" width=330px height=250px><IMG alt=Help id="image" src="<%=initPict6%>" align=absBottom border=0 name="pict6"></td>
	</tr>
	<tr>
	<td align="center" class="boldtext"><%=comment6%></td>
	</tr>
	</table>
	</td>
	<% } %>
	</tr>
</table>
</td>
</tr>